package com.neu.wangweili.servlet;

import com.neu.wangweili.service.W_StuService;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "DeleteStuServlet", urlPatterns = {"/DeleteStuServlet"})
public class DeleteStuServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        String stu_id=request.getParameter("stu_id");
        W_StuService WStuService =new W_StuService();
        int row= WStuService.delete(stu_id);

        if (row>0){
            request.getRequestDispatcher("commons/success.jsp").forward(request,response);
        }
        System.out.println(stu_id);
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
